<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定位</title>
    <style>
        .box1 {
            height: 350px;
            background-color: aqua;
        }
        .box2 {
            height: 350px;
            background-color: antiquewhite;
        }
        .box-normal {
            width: 100px;
            height: 100px;
            background-color: purple;
        }
        .box-relative {
            height: 100px;
            width: 100px;
            background-color: azure;
            position: relative;
            /* position:relative 即是将元素改为相对定位 */
        }
        .box-absolute {
            width: 100px;
            height: 100px;
            background-color: cadetblue;
            position: absolute;
            margin-left: 100px;
        }
        .box-fix {
            width: 100px;
            height: 100px;
            position: fixed;
            background-color: antiquewhite;
        }
    </style>
</head>
<body>
    <h1>相对定位</h1>
    <div class="box1">
        <div class="box-normal"></div>
        <div class="box-relative"></div>
        <div class="box-normal"></div>  
    </div>
    <h1>绝对定位</h1>
    <div class="box2">
        <div class="box-normal"></div>
        <div class="box-absolute"></div>
        <div class="box-normal"></div>  
    </div>
    <h1>固定定位</h1>
    <div class="box-fix"></div>
</body>
</html>